package transfer

import "time"

const (
	Oper_Init_Test         = "T"
	Oper_Init_Finance      = "F" //财务数据初始化命令行参数 Financial
	Oper_Init_Announcement = "A" //公告数据初始化命令行参数 Announcement
	Oper_Init_SKDAILYPRICE = "S" // SK DAILYPRICE
	Oper_Init_News         = "N" // 资讯
	Oper_Init_Info         = "I" // 资料
	Oper_Init_Load         = "L" // 补充数据

	Oper_Monitor_FIRST     = "M1" //第一次启动goCanal命令行参数
	Oper_Monitor           = "M"  //启动goCanal命令行参数
	GoCanal_First_Run_Flag = "1"  // 第一次启动goCanal标识
	GoCanal_Run_Flag       = "2"

	//标准评级
	STDRATING_BUY     = "1" //买入
	STDRATING_ENLARGE = "2" //增持
	STDRATING_NEUTRAL = "3" //中性
	STDRATING_REDUCE  = "4" //减持
	STDRATING_SELL    = "5" //卖出
	STDRATING_NO      = "9" //未披露

	//评级有效期
	RATINGVALID_NO      = "0" //无具体期限
	RATINGVALID_3MONTH  = "1" //3个月
	RATINGVALID_6MONTH  = "2" //6个月
	RATINGVALID_12MONTH = "3" //12个月
	RATINGVALID_18MONTH = "4" //18个月

	//企业整体经营收入分类口径
	TYPE_STYLE_TRADE   = "1" //行业
	TYPE_STYLE_PRODUCT = "2" //产品
	TYPE_STYLE_REGION  = "3" //地区

	//证券类别
	SETYPE_101 = "101" //国内A股
	SETYPE_102 = "102" //国内B股
	SETYPE_103 = "103" //三板A股
	SETYPE_104 = "104" //三板B股
	SETYPE_108 = "108" //CDR
	SETYPE_109 = "109" //优先股

	//报告类型
	REPORTTYPE_1 = "1" // 合并期末
	REPORTTYPE_2 = "2" // 母公司期末
	REPORTTYPE_3 = "3" // 合并期初
	REPORTTYPE_4 = "4" // 母公司期初

	REPORT_DATE_TYPE_1 = "1" // 一季报
	REPORT_DATE_TYPE_2 = "2" //中报（累计）
	REPORT_DATE_TYPE_3 = "3" //三季报（累计）
	REPORT_DATE_TYPE_4 = "4" //年报(累计)

	REPORTTYPE_c3 = "3" // 合并期末_调整
	REPORTTYPE_c4 = "4" // 母公司期末_调整

	//1新增，2修改，3删除
	INSERT_ACTION = "1"
	UPDATE_ACTION = "2"
	DELETE_ACTION = "3"

	//机构上市状态
	LISTSTATUS_0 = "0" //未上市（等待上市）
	LISTSTATUS_1 = "1" //上市
	LISTSTATUS_2 = "2" //退市
	LISTSTATUS_3 = "3" //非上市

	TQCOMPINFO_BDFI  = "C" //银行业存款类金融机构
	TQCOMPINFO_BNDFI = "D" //银行业非存款类金融机构

	ANNTFILE_TQ_SK_ANNOUNCEMT = "1" // 公告文件关联表

	// 数据补充业务表
	ZYZB = "zyzb" //主要指标
	ZCFZ = "zcfz" // 资产负债表
	LR   = "lr"   //利润
	XJL  = "xjl"  //现金流

	ZYZBDJD = "zyzbdjd" //主要指标
	LRDJD   = "lrdjd"   //利润
	XJLDJD  = "xjldjd"  //现金流

	ZXZB   = "zxzb"   // 最新指标
	DSTX   = "dstx"   // 大事提醒
	FHPS   = "fhps"   //分红派送
	RZRQ   = "rzrq"   // 融资融券
	YLYC   = "ylyc"   // 盈利预测
	JGPJXX = "jgpjxx" //机构评级信息
	JGPJTJ = "jgpjtj" // 机构评级统计
	GSJK   = "gsjk"   //公司简况
	GSZYYW = "gszyyw" //公司主要业务
	GSGG   = "gsgg"   //公司高管
	GBJG   = "gbjg"   // 股本结构
	GBBD   = "gbbd"   // 股本变动
	SDLTGD = "sdltgd" //十大流通股东
	SDGD   = "sdgd"   // 十大股东
	FHRZ   = "fhrz"   // 分红融资
	LHB    = "lhb"    // 龙虎榜
	DZJY   = "dzjy"   // 大宗交易
	GDBD   = "gdbd"   // 股东变动
)

var (
	// 企业现金流SQL
	INSERT_CASH_FLOW_SQL = " INSERT INTO `CASH_FLOW`(`REPORTYEAR`,`REPORTDATETYPE`,`BIZCASHINFL`,`BIZCASHOUTF`,`MANANETR`,`INVCASHINFL`,`INVCASHOUTF`,`INVNETCASHFLOW`,`FINCASHINFL`,`FINCASHOUTF`,`FINNETCFLOW`,`CASHNETR`,`SYMBOL`,`COMPCODE`,`EXCHANGE`) " +
		"VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_CASH_FLOW_SQL = " UPDATE `CASH_FLOW` SET BIZCASHINFL=?,BIZCASHOUTF=?,MANANETR=?,INVCASHINFL=?,INVCASHOUTF=?,INVNETCASHFLOW=?,FINCASHINFL=?,FINCASHOUTF=?,FINNETCFLOW=?,CASHNETR=? WHERE  COMPCODE=? AND REPORTYEAR = ? AND REPORTDATETYPE=? AND ID > 0"
	DELETE_CASH_FLOW_SQL = "DELETE FROM `CASH_FLOW` WHERE COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//一般企业利润
	INSERT_INCOME_STATEMENT_SQL = "INSERT INTO `INCOME_STATEMENT`(`SYMBOL`,`REPORTYEAR`,`REPORTDATETYPE`,`BIZTOTINCO`,`BIZTOTCOST`,`MANAEXPE`,`SALESEXPE`,`FINEXPE`,`PERPROFIT`,`INVEINCO`,`NONOREVE`,`NONOEXPE`,`TOTPROFIT`,`NETPROFIT`,`COMPCODE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_INCOME_STATEMENT_SQL = "UPDATE `INCOME_STATEMENT` SET `BIZTOTINCO` = ?,`BIZTOTCOST` = ?,`MANAEXPE` = ?,`SALESEXPE` = ?,`FINEXPE` =?,`PERPROFIT` = ?,`INVEINCO` = ?,`NONOREVE` = ?,`NONOEXPE` = ?,`TOTPROFIT` = ?,`NETPROFIT` = ? WHERE `COMPCODE` = ? AND `REPORTYEAR` = ? AND  `REPORTDATETYPE` =? AND `ID` > 0"
	DELETE_INCOME_STATEMENT_SQL = "DELETE FROM `INCOME_STATEMENT` WHERE COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//资产负债表
	INSERT_BALANCE_SHEET_SQL = "INSERT INTO `BALANCE_SHEET`(`REPORTYEAR`,`REPORTDATETYPE`,`TOTCURRASSET`,`CURFDS`,`TRADFINASSET`,`INVE`,`ACCORECE`,`OTHERRECETOT`,`TOTALNONCASSETS`,`FIXEDASSENET`,`AVAISELLASSE`,`INTAASSET`,`GOODWILL`,`TOTASSET`,`TOTALCURRLIAB`,`ADVAPAYM`,`ACCOPAYA`,`TOTALNONCLIAB`,`TOTLIAB`,`PARESHARRIGH`,`CAPISURP`,`SHORTTERMBORR`,`SYMBOL`,`COMPCODE`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_BALANCE_SHEET_SQL = "UPDATE `BALANCE_SHEET` SET `TOTCURRASSET` = ?,`CURFDS` = ?,`TRADFINASSET` = ?,`INVE` = ?,`ACCORECE` = ?,`OTHERRECETOT` = ?,`TOTALNONCASSETS` = ?,`FIXEDASSENET` =?,`AVAISELLASSE` = ?,`INTAASSET` = ?,`GOODWILL` = ?,`TOTASSET` = ?,`TOTALCURRLIAB` = ?,`ADVAPAYM` = ?,`ACCOPAYA` = ?,`TOTALNONCLIAB` = ?,`TOTLIAB` = ?,`PARESHARRIGH` = ?,`CAPISURP` = ?,`SHORTTERMBORR` = ? WHERE `COMPCODE` =? AND `REPORTYEAR` = ? AND `REPORTDATETYPE` = ? AND `ID` > 0"
	DELETE_BALANCE_SHEET_SQL = "DELETE FROM `BALANCE_SHEET` WHERE COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//财务主要指标
	INSERT_KEY_INDICATOR_SQL = "INSERT INTO `KEY_INDICATOR`(`REPORTYEAR`,`REPORTDATETYPE`,`EPSBASIC`,`CRPS`,`NAPS`,`UPPS`,`OPNCFPS`,`SNPMARGINCONMS`,`OPPRORT`,`PROFITRATIO`,`ROEWEIGHTED`,`ROEDILUTED`,`CURRENTRT`,`QUICKRT`,`SYMBOL`,`COMPCODE`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"

	//公告
	INSERT_ANNOUNCEMENT_SQL = "INSERT INTO `ANNOUNCEMENT`(`ANNOUNCEMTID`,`COMPCODE`,`SYMBOL`,`ANNTITLE`,`ANNTEXT`,`DECLAREDATE`,`SHARES`,`VIEWS`,`COLLECTIONS`,`EXCHANGE`,`FILELINK`) VALUES(?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_ANNOUNCEMENT_SQL = "UPDATE `ANNOUNCEMENT` SET `ANNTITLE` = ?,`ANNTEXT` = ?,`DECLAREDATE` = ? ,`FILELINK` = ?  WHERE `COMPCODE` = ? AND `ANNOUNCEMTID` = ? AND `ID` > 0"
	DELETE_ANNOUNCEMENT_SQL = "DELETE FROM `ANNOUNCEMENT` WHERE COMPCODE = ? AND ANNOUNCEMTID = ? "

	//财务主要指标-单季度
	INSERT_KEY_INDICATOR_SQ_SQL = "INSERT INTO `KEY_INDICATOR_SQ`(`REPORTYEAR`,`REPORTDATETYPE`,`EPSBASIC`,`CRPS`,`NAPS`,`UPPS`,`OPNCFPS`,`SNPMARGINCONMS`,`OPPRORT`,`PROFITRATIO`,`ROEWEIGHTED`,`ROEDILUTED`,`CURRENTRT`,`QUICKRT`,`SYMBOL`,`COMPCODE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_KEY_INDICATOR_SQ_SQL = "UPDATE `KEY_INDICATOR_SQ` SET `EPSBASIC` = ?,`CRPS` = ?,`NAPS` = ?,`UPPS` = ?,`OPNCFPS` = ?,`SNPMARGINCONMS` = ?,`OPPRORT` = ?,`PROFITRATIO` = ?,`ROEWEIGHTED` = ?,`ROEDILUTED` = ?,`CURRENTRT` = ?,`QUICKRT` = ? WHERE `COMPCODE` = ? AND `REPORTYEAR` = ? AND `REPORTDATETYPE` = ? AND ID > 0"
	DELETE_KEY_INDICATOR_SQ_SQL = "DELETE FROM `KEY_INDICATOR_SQ` WHERE  COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//一般企业利润-单季度
	INSERT_INCOME_STATEMENT_SQ_SQL = "INSERT INTO `INCOME_STATEMENT_SQ`(`SYMBOL`,`REPORTYEAR`,`REPORTDATETYPE`,`BIZTOTINCO`,`BIZTOTCOST`,`MANAEXPE`,`SALESEXPE`,`FINEXPE`,`PERPROFIT`,`INVEINCO`,`NONOREVE`,`NONOEXPE`,`TOTPROFIT`,`NETPROFIT`,`COMPCODE`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_INCOME_STATEMENT_SQ_SQL = "UPDATE `INCOME_STATEMENT_SQ` SET `BIZTOTINCO` = ?,`BIZTOTCOST` = ?,`MANAEXPE` = ?,`SALESEXPE` = ?,`FINEXPE` = ?,`PERPROFIT` = ?,`INVEINCO` = ?,`NONOREVE` = ?,`NONOEXPE` = ?,`TOTPROFIT` = ?,`NETPROFIT` = ? WHERE `COMPCODE` = ? AND  `REPORTYEAR` = ? AND  `REPORTDATETYPE` = ? AND ID > 0"
	DELETE_INCOME_STATEMENT_SQ_SQL = "DELETE FROM `INCOME_STATEMENT_SQ` WHERE COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//现金流-单季度
	INSERT_CASH_FLOW_SQ_SQL = "INSERT INTO `CASH_FLOW_SQ`(`REPORTYEAR`,`REPORTDATETYPE`,`BIZCASHINFL`,`BIZCASHOUTF`,`MANANETR`,`INVCASHINFL`,`INVCASHOUTF`,`INVNETCASHFLOW`,`FINCASHINFL`,`FINCASHOUTF`,`FINNETCFLOW`,`CASHNETR`,`SYMBOL`,`COMPCODE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_CASH_FLOW_SQ_SQL = "UPDATE `CASH_FLOW_SQ` SET `BIZCASHINFL` = ?,`BIZCASHOUTF` = ?,`MANANETR` = ?,`INVCASHINFL` = ?,`INVCASHOUTF` =?,`INVNETCASHFLOW` = ?,`FINCASHINFL` = ?,`FINCASHOUTF` = ?,`FINNETCFLOW` = ?,`CASHNETR` = ? WHERE `COMPCODE` = ? AND `REPORTYEAR` =? AND `REPORTDATETYPE` = ? AND ID > 0"
	DELETE_CASH_FLOW_SQ_SQL = "DELETE FROM `CASH_FLOW_SQ` WHERE COMPCODE = ? AND REPORTYEAR = ? AND REPORTDATETYPE = ?"

	//股票涨跌情况数据
	INSERT_SK_INFO_CHANGE_SQL = "INSERT INTO `SK_INFO_CHANGE`(`SYMBOL`,`SENAME`,`CHANGE`,`PCHG`,`EXCHANGE`) VALUES(?,?,?,?,?)"
	UPDATE_SK_INFO_CHANGE_SQL = "UPDATE `SK_INFO_CHANGE` SET `SENAME` = ?,`CHANGE` = ?,`PCHG` = ? WHERE `SYMBOL` =?  AND ID > 0"
	DELETE_SK_INFO_CHANGE_SQL = "DELETE FROM `SK_INFO_CHANGE` WHERE `SYMBOL`=?"

	//快讯数据
	INSERT_NEWS_SQL = "INSERT INTO `NEWS`(`ID`,`NEWSTITLE_ME`,`NEWSTEXT_ME`,`NEWSSOURCE_ME`,`PUBLISHTIME`,`SYMBOL`,`LABEL_ORDER`,`LABEL`,`TITLEFONTSTYLE`,`PUBLISH_STATUS`,`VIEWS`,`SHARES`,`COLLECTIONS`,`EXCHANGE`,`SORTTIME`,`SOURCEKEY`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_NEWS_SQL = "UPDATE `NEWS` SET `NEWSTITLE_ME` = ?,`NEWSTEXT_ME` = ?,`NEWSSOURCE_ME` = ?, `PUBLISHTIME` = ? WHERE `SOURCEKEY` = ? AND ID > 0"
	DELETE_NEWS_SQL = "DELETE FROM `NEWS` WHERE  `SOURCEKEY` = ? "

	//公司大事
	INSERT_EVENT_REMIND_SQL = "INSERT INTO `EVENT_REMIND`(`DECLAREDATE`,`EVENTTEXT`,`SOURCETABLE`,`COMPCODE`,`SYMBOL`,`EVENTTITLE`,`RANK`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?)"
	UPDATE_EVENT_REMIND_SQL = "UPDATE `EVENT_REMIND` SET `EVENTTEXT` = ?,`SOURCETABLE` =? WHERE `COMPCODE` =? AND `DECLAREDATE` = ? AND `EVENTTITLE` = ? AND `RANK`= ? AND ID > 0"
	DELETE_EVENT_REMIND_SQL = "DELETE FROM `EVENT_REMIND` WHERE  `COMPCODE` =? AND `DECLAREDATE` = ? AND `EVENTTITLE` = ? AND `RANK`= ? "

	//分红配送
	INSERT_DIVIDEND_SQL = "INSERT INTO `DIVIDEND`(`COMPCODE`,`SYMBOL`,`BONUSIMPDATE`,`EXRIGHTDATE`,`CDIVIDEND`,`BONUSYEAR`,`DIVIDTYPE`,`DIVITYPE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?)"
	UPDATE_DIVIDEND_SQL = "UPDATE `DIVIDEND` SET `BONUSIMPDATE` = ?,`CDIVIDEND` =?  WHERE `COMPCODE` = ? AND `EXRIGHTDATE` = ? AND `BONUSYEAR` = ? AND  `DIVIDTYPE` = ? AND `DIVITYPE` = ? AND ID > 0"
	DELETE_DIVIDEND_SQL = "DELETE FROM `DIVIDEND` WHERE COMPCODE = ?  AND `EXRIGHTDATE` = ? AND `BONUSYEAR` = ? AND  `DIVIDTYPE` = ? AND `DIVITYPE` = ?"

	//融资融券
	INSERT_MARGIN_SQL = "INSERT INTO `MARGIN` (`TRADEDATE`,`SYMBOL`,`COMPCODE`,`FINBALANCE`,`FINBUYAMT`,`MRGGBAL`,`MRGNRESQTY`,`MRGNSELLAMT`,`FINMRGHBAL`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?)"
	UPDATE_MARGIN_SQL = "UPDATE `MARGIN` SET `COMPCODE` = ?,`FINBALANCE` = ?,`FINBUYAMT` = ?,`MRGGBAL` = ?,`MRGNRESQTY` = ?,`MRGNSELLAMT` = ?, `FINMRGHBAL` = ? WHERE `SYMBOL` = ? AND `TRADEDATE` =?  AND ID > 0"
	DELETE_MARGIN_SQL = "DELETE FROM `MARGIN` WHERE `SYMBOL` = ? AND `TRADEDATE` =? "

	//盈利预测
	INSERT_PROFIT_FORECAST_SQL = "INSERT INTO `PROFIT_FORECAST`(`EXPTYEAR`,`OPERMINCOME`,`RETAMAXPROFITS`,`EPSMAXFORE`,`COMPCODE`,`SYMBOL`,`PUBLISHDATE`,`DATASOURCE`,`SESSIONBEGDATE`,`SESSIONENDDATE`,`BASESSIONBEGDATE`,`BASESSIONENDDATE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_PROFIT_FORECAST_SQL = "UPDATE `PROFIT_FORECAST` SET `EXPTYEAR` =?, `OPERMINCOME` = ?,`RETAMAXPROFITS` = ?,`EPSMAXFORE` = ? WHERE `COMPCODE` = ? AND `PUBLISHDATE` = ? AND `DATASOURCE` = ? AND `SESSIONBEGDATE` = ? AND `SESSIONENDDATE` = ? AND `BASESSIONBEGDATE` = ? AND `BASESSIONENDDATE` = ? AND ID > 0"
	DELETE_PROFIT_FORECAST_SQL = "DELETE FROM `PROFIT_FORECAST` WHERE `COMPCODE` = ? AND `PUBLISHDATE` = ? AND `DATASOURCE` = ? AND `SESSIONBEGDATE` = ? AND `SESSIONENDDATE` = ? AND `BASESSIONBEGDATE` = ? AND `BASESSIONENDDATE` = ? "

	INSERT_PROFIT_FORECAST_SQL_NEW = "INSERT INTO `PROFIT_FORECAST`(`EXPTYEAR`,`OPERMINCOME`,`RETAMAXPROFITS`,`EPSMAXFORE`,`COMPCODE`,`SYMBOL`,`PUBLISHDATE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?)"
	UPDATE_PROFIT_FORECAST_SQL_NEW = "UPDATE `PROFIT_FORECAST` SET  `OPERMINCOME` = ?,`RETAMAXPROFITS` = ?,`EPSMAXFORE` = ? , `PUBLISHDATE` = ? WHERE `COMPCODE` = ? AND `SYMBOL` =?   AND `EXPTYEAR` =? AND ID > 0"
	// 单纯更新
	UPDATE_PROFIT_FORECAST_SQL_NEW2 = "UPDATE `PROFIT_FORECAST` SET  `OPERMINCOME` = ?,`RETAMAXPROFITS` = ?,`EPSMAXFORE` = ?   WHERE `COMPCODE` = ? AND `SYMBOL` =?  AND `PUBLISHDATE` = ? AND `EXPTYEAR` =? AND ID > 0"

	DELETE_PROFIT_FORECAST_SQL_NEW = "DELETE FROM `PROFIT_FORECAST` WHERE `COMPCODE` = ? AND `SYMBOL` =? AND `PUBLISHDATE` = ?  "

	//机构评级统计
	INSERT_RATING_COUNT_SQL = "INSERT INTO `RATING_COUNT` (`BUY`,`ENLARGE`,`NEUTRAL`,`REDUCE`,`SELL`,`RATINGVALID`,`STDRATING`,`COMPCODE`,`SYMBOL`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?)"
	UPDATE_RATING_COUNT_SQL = "UPDATE `RATING_COUNT` SET `BUY` = ?,`ENLARGE` =?,`NEUTRAL` = ?, `REDUCE` = ?, `SELL` = ? WHERE `SYMBOL` = ?  AND `RATINGVALID` =? AND ID > 0"
	DELETE_RATING_COUNT_SQL = "DELETE FROM `RATING_COUNT` WHERE `SYMBOL` = ?  AND `RATINGVALID` =? "

	//机构评级信息
	INSERT_RATING_SQL = "INSERT INTO `RATING`(`SKCODE`,`REPORTDATE`,`COMPNAME`,`RATING`,`LASTRATING`,`RADJUSTDIR`,`COMPCODE`,`SYMBOL`,`RATINGVALID`,`ANALYSTNAME`,`EXCHANGE`)VALUES(?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_RATING_SQL = "UPDATE `RATING` SET `COMPNAME` = ?,`RATING` =?,`LASTRATING` = ?,`RADJUSTDIR` =?,`EXCHANGE` = ? WHERE `SKCODE` = ? AND  `REPORTDATE` =  ? AND  `RATINGVALID` =  ?  AND  `ANALYSTNAME` =  ?  AND ID > 0"
	DELETE_RATING_SQL = "DELETE FROM `RATING` WHERE  `SKCODE` = ? AND  `REPORTDATE` =  ? AND  `RATINGVALID` =  ?  AND  `ANALYSTNAME` =  ? "

	//股本结构
	INSERT_EQUITY_STRUCTURE_SQL = "INSERT INTO `EQUITY_STRUCTURE`(`COMPCODE`,`SYMBOL`,`TOTALSHARE`,`CIRCSKAMT`,`CIRCSKRTO`,`CIRCSKAMTNOLIM`,`CIRCSKRTONOLIM`,`CIRCHAMT`,`HSHARERTO`,`NCIRCAMT`,`NONNEGSKRTO`,`CIRCAAMT`,`ASHARERTO`,`CIRCBAMT`,`BSHARERTO`,`NCIRCAMT1`,`NONNEGSKRTO1`,`BEGINDATE`,`EXRIGHTDATE`,`PUBLISHDATE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_EQUITY_STRUCTURE_SQL = "UPDATE `EQUITY_STRUCTURE` SET `TOTALSHARE` = ?,`CIRCSKAMT` = ?,`CIRCSKRTO` =?,`CIRCSKAMTNOLIM` = ?,`CIRCSKRTONOLIM` = ?,`CIRCHAMT` = ?,`HSHARERTO` = ?,`NCIRCAMT` = ?,`NONNEGSKRTO` =?,`CIRCAAMT` = ?,`ASHARERTO` = ?,`CIRCBAMT` = ?,`BSHARERTO` =?,`NCIRCAMT1` = ?,`NONNEGSKRTO1` = ? ,`PUBLISHDATE` = ? WHERE `BEGINDATE` = ? AND `COMPCODE` = ? AND `EXRIGHTDATE` = ?  AND ID > 0"
	DELETE_EQUITY_STRUCTURE_SQL = "DELETE FROM `EQUITY_STRUCTURE` WHERE  `BEGINDATE` = ? AND `COMPCODE` = ? AND `EXRIGHTDATE` = ?"

	//股本变动
	INSERT_EQUITY_STRUCTURE_CHANGE_SQL = "INSERT INTO `EQUITY_STRUCTURE_CHANGE`(`BEGINDATE`,`SHCHGRSN`,`TOTALSHARE`,`TOTALSHARECHG`,`SKCHGEXP`,`COMPCODE`,`SYMBOL`,`EXRIGHTDATE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?)"
	UPDATE_EQUITY_STRUCTURE_CHANGE_SQL = "UPDATE `EQUITY_STRUCTURE_CHANGE` SET `SHCHGRSN` = ?,`TOTALSHARE` =?,`TOTALSHARECHG` = ?,`SKCHGEXP` =? WHERE `BEGINDATE` = ? AND `COMPCODE` = ? AND `EXRIGHTDATE` = ? AND ID > 0"
	DELETE_EQUITY_STRUCTURE_CHANGE_SQL = "DELETE FROM `EQUITY_STRUCTURE_CHANGE` WHERE `BEGINDATE` = ? AND `COMPCODE` = ? AND `EXRIGHTDATE` = ?"

	//十大流通股股东
	INSERT_TEN_CIRCULATING_SHARES_HOLDER_SQL = "INSERT INTO `TEN_CIRCULATING_SHARES_HOLDER`(`SHHOLDERNAME`,`HOLDERRTO`,`PCTOFFLOTSHARES`,`HOLDERSUMCHG`,`HOLDERSUMCHGRATE`,`SHHOLDERCODE`,`HOLDERAMT`,`PUBLISHDATE`,`COMPCODE`,`SYMBOL`,`ENDDATE`,`RANK`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_TEN_CIRCULATING_SHARES_HOLDER_SQL = "UPDATE `TEN_CIRCULATING_SHARES_HOLDER` SET `HOLDERRTO` = ?,`PCTOFFLOTSHARES` = ?,`HOLDERSUMCHG` = ?,`HOLDERSUMCHGRATE` = ?,`SHHOLDERCODE` = ?,`HOLDERAMT` = ?,`PUBLISHDATE` = ? WHERE `COMPCODE` = ? AND `SHHOLDERNAME` = ? AND  `ENDDATE` = ? AND `RANK` = ? AND  ID > 0"
	DELETE_TEN_CIRCULATING_SHARES_HOLDER_SQL = "DELETE FROM `TEN_CIRCULATING_SHARES_HOLDER` WHERE  `COMPCODE` = ? AND `SHHOLDERNAME` = ? AND  `ENDDATE` = ? AND `RANK` = ?"

	//分红融资
	INSERT_BONUS_FINANCING_SQL = "INSERT INTO `BONUS_FINANCING`(`RECORDDATE`,`EXRIGHTDATE`,`DIVIBEGDATE`,`TAXCDIVIDEND`,`BONUSIMPDATE`,`CAPSTKBASDATE`,`DIVIIMPMARKD`,`COMPCODE`,`SYMBOL`,`BONUSYEAR`,`DIVIDTYPE`,`DIVITYPE`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_BONUS_FINANCING_SQL = "UPDATE `BONUS_FINANCING` SET `RECORDDATE` = ?,`DIVIBEGDATE` = ?,`TAXCDIVIDEND` = ?,`BONUSIMPDATE` = ?,`CAPSTKBASDATE` = ?,`DIVIIMPMARKD` = ? WHERE `COMPCODE` = ? AND `BONUSYEAR` = ?  AND `DIVIDTYPE` = ?  AND `DIVITYPE` = ? AND `EXRIGHTDATE` = ? AND ID > 0"
	DELETE_BONUS_FINANCING_SQL = "DELETE FROM `BONUS_FINANCING` WHERE `COMPCODE` = ? AND `BONUSYEAR` = ?  AND `DIVIDTYPE` = ?  AND `DIVITYPE` = ? AND `EXRIGHTDATE` = ?"

	//龙虎榜
	INSERT_RANK_LIST_SQL = "INSERT INTO `RANK_LIST` (`SYMBOL`,`COMPCODE`,`TRADEDATE`,`BIZSUNITNAME`,`AMOUNT`,`BUYAMT`,`SALEAMT`,`CHGTYPE`,`BIZSUNITCODE`,`TRANSDIR`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_RANK_LIST_SQL = "UPDATE `RANK_LIST` SET `COMPCODE` =?,`BIZSUNITNAME` = ?,`AMOUNT` = ?,`BUYAMT` =?,`SALEAMT` = ?, `EXCHANGE` = ? WHERE `SYMBOL` = ? AND `TRADEDATE` = ? AND `CHGTYPE` = ? AND `BIZSUNITCODE` = ? AND `TRANSDIR` = ? AND  ID > 0"
	DELETE_RANK_LIST_SQL = "DELETE FROM `RANK_LIST` WHERE `SYMBOL` = ? AND `TRADEDATE` = ? AND `CHGTYPE` = ? AND `BIZSUNITCODE` = ? AND `TRANSDIR` = ?"

	//大宗交易
	INSERT_BLOCK_TRADING_SQL = "INSERT INTO `BLOCK_TRADING` (`SYMBOL`,`COMPCODE`,`TRADEDATE`,`TRADEPRICE`,`VOLUME`,`AMOUNT`,`BUYERNAME`,`SELLERNAME`,`RATE`,`BLOCKTRADEID`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_BLOCK_TRADING_SQL = "UPDATE `BLOCK_TRADING` SET `COMPCODE` = ?,`TRADEDATE` = ?,`TRADEPRICE` = ?,`VOLUME` = ?,`AMOUNT` = ?,`BUYERNAME` = ?,`SELLERNAME` = ?,`RATE` =? WHERE `SYMBOL` =? AND `BLOCKTRADEID` = ? AND `EXCHANGE` = ? AND ID > 0"
	DELETE_BLOCK_TRADING_SQL = "DELETE FROM `BLOCK_TRADING` WHERE `SYMBOL` =? AND `BLOCKTRADEID` = ? AND `EXCHANGE` = ?"

	//公司高管信息
	INSERT_COMPANY_EXECUTIVES_SQL = "INSERT INTO `COMPANY_EXECUTIVES` (`SYMBOL`,`COMPCODE`,`CNAME`,`ACTDUTYNAME`,`BEGINDATE`,`GENDER`,`BIRTHDAY`,`DEGREE`,`MEMO`,`PERSONALCODE`,`POSTYPE`,`NOWSTATUS`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_COMPANY_EXECUTIVES_SQL = "UPDATE `COMPANY_EXECUTIVES` SET `CNAME` = ?,`GENDER` =?,`BIRTHDAY` = ?,`DEGREE` = ?,`MEMO` = ?,`POSTYPE` = ?,`NOWSTATUS` = ? WHERE `COMPCODE` =?  AND `PERSONALCODE` = ? AND `ACTDUTYNAME` = ? AND `BEGINDATE` =? AND ID > 0 "
	DELETE_COMPANY_EXECUTIVES_SQL = "DELETE FROM `COMPANY_EXECUTIVES` WHERE `COMPCODE` =?  AND `PERSONALCODE` = ? AND `ACTDUTYNAME` = ? AND `BEGINDATE` =?"

	//公司主要业务
	INSERT_MAIN_COMPOSITION_SQL = "INSERT INTO `MAIN_COMPOSITION` (`PRODUCTINFO`,`BIZTOTCOST`,`REPORTYEAR`,`PERPROFIT`,`COMPCODE`,`SYMBOL`,`PUBLISHDATE`,`TYPESTYLE`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?)"
	UPDATE_MAIN_COMPOSITION_SQL = "UPDATE `MAIN_COMPOSITION` SET `PRODUCTINFO` = ?,`BIZTOTCOST` = ?,`REPORTYEAR` = ?,`PERPROFIT` = ? WHERE `COMPCODE` =? AND `PUBLISHDATE` =? AND  `TYPESTYLE` =?  AND ID > 0"
	DELETE_MAIN_COMPOSITION_SQL = "DELETE FROM `MAIN_COMPOSITION` WHERE `COMPCODE` =? AND `PUBLISHDATE` =? AND  `TYPESTYLE` =? "

	//机构资料信息
	INSERT_COMPANY_PROFILE_SQL = "INSERT INTO `COMPANY_PROFILE`(`COMPNAME`,`REGNAME`,`COMPTYPE`,`LISTDATE`,`LEGREP`,`REGCAPITAL`,`REGADDR`,`MAJORBIZ`,`BIZSCOPE`,`COMPCODE`,`SYMBOL`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_COMPANY_PROFILE_SQL = "UPDATE `COMPANY_PROFILE` SET `COMPNAME` = ?,`REGNAME` = ?,`COMPTYPE` = ?,`LISTDATE` = ?,`LEGREP` = ?,`REGCAPITAL` = ?,`REGADDR` = ?,`MAJORBIZ` = ?,`BIZSCOPE` =? WHERE `COMPCODE` = ? AND `SYMBOL` = ? AND `EXCHANGE` = ? AND ID > 0"
	DELETE_COMPANY_PROFILE_SQL = "DELETE FROM `COMPANY_PROFILE` WHERE `COMPCODE` = ? AND `SYMBOL` = ? AND `EXCHANGE` = ?"

	//股东变化
	INSERT_HOLDER_CHANGE_SQL = "INSERT INTO `HOLDER_CHANGE`(`ENDDATE`,`TCLOSE`,`TOTALSHAMT`,`TOTALSHCHGRTO`,`KAVGSH`,`KAVGHOLDAMT`,`COMPCODE`,`SYMBOL`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?)"
	UPDATE_HOLDER_CHANGE_SQL = "UPDATE `HOLDER_CHANGE` SET `TCLOSE` = ?,`TOTALSHAMT` = ?,`TOTALSHCHGRTO` = ?,`KAVGSH` = ?,`KAVGHOLDAMT` = ? WHERE `COMPCODE` = ? AND `ENDDATE` = ?"
	DELETE_HOLDER_CHANGE_SQL = "DELETE FROM `stock`.`HOLDER_CHANGE` WHERE `COMPCODE` = ? AND `ENDDATE` = ?"

	//十大股东
	INSERT_TEN_HOLDER_SQL = "INSERT INTO `TEN_HOLDER` (`SHHOLDERNAME`,`HOLDERAMT`,`HOLDERRTO`,`HOLDCIRCSKAMTRTO`,`CURCHG`,`SHHOLDERCODE`,`PUBLISHDATE`,`COMPCODE`,`SYMBOL`,`CURCHGRATE`,`ENDDATE`,`RANK`,`EXCHANGE`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"
	UPDATE_TEN_HOLDER_SQL = "UPDATE `TEN_HOLDER` SET `HOLDERAMT` = ?,`HOLDERRTO` = ?,`HOLDCIRCSKAMTRTO` = ?,`CURCHG` = ?,`SHHOLDERCODE` = ?,`PUBLISHDATE` = ?,`CURCHGRATE` =? WHERE `COMPCODE` = ? AND `SHHOLDERNAME`  = ? AND `ENDDATE` = ? AND `RANK` = ? AND ID > 0"
	DELETE_TEN_HOLDER_SQL = "DELETE FROM `TEN_HOLDER` WHERE `COMPCODE` = ? AND `SHHOLDERNAME`  = ? AND `ENDDATE` = ? AND `RANK` = ? "

	//最新指标
	INSERT_LATEST_INDICATOR_SQL = "INSERT INTO `LATEST_INDICATOR` (`REPORTYEAR`,`REPORTDATETYPE`,`BASICEPS`,`EPSBASICEPSCUT`,`NAPS`,`OPERCFPS`,`ROE`,`SGPMARGIN`,`BIZINCO`,`OPERINYOYB`,`NETPROFIT`,`NETINPNRPLYOYB`,`NPCUT`,`NPGRT`,`TOTALSHARE`,`COMPCODE`,`SYMBOL`,`EXCHANGE`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
	DELETE_LATEST_INDICATOR_SQL = "DELETE FROM `LATEST_INDICATOR` WHERE `COMPCODE` = ? AND  `SYMBOL` = ? AND  `EXCHANGE` = ?"

	INSERT_ARTICLE_SQL = "INSERT INTO `articles`(`sort_date`,`column_level`,`sk_id`)VALUES(?,?,?)"
)

//TransferExchane 交易所转换
func TransferExchane(param string) string {
	result := ""
	switch param {
	case "001002": //上海证券交易所
		result = "36"
	case "001003": //深圳证券交易所
		result = "37"
	case "001066": //北京证券交易所
		result = "38"
	case "001004": //股份转让系统
		result = "51"
	case "002001": //香港证券交易所
		result = "15" // 香港HKEX
	}
	return result
}

//GetNowTime 取得当前时间的格式化字符串
func GetNowTime() string {
	currentTime := time.Now()
	strTime := currentTime.Format("2006-01-02 15:04:05")
	return strTime
}
